package com.ykwep.web.server;

import java.util.Collection;
import java.util.List;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;

import com.ykwep.web.server.data.DataStoreObject;
import com.ykwep.web.server.data.Page;

public final class PMF {
    private static final PersistenceManagerFactory pmfInstance =
        JDOHelper.getPersistenceManagerFactory("transactions-optional");

    private PMF() {}

    public static PersistenceManagerFactory get() {
        return pmfInstance;
    }
    
    public static String makeXMLSafe(String string) {
		return string.replaceAll("<","&lt;").replaceAll(">","&gt;");
	}
    
    public static String removeEscapeForAnd(String string) {
		return string.replaceAll("&amp;","&");
	}

	public static Collection preDeatach(List<DataStoreObject> list) {
		for(DataStoreObject i: list)
			i.preDeatach();
		return list;
	}

}